package lab02.test36;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Test36 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("请输入学生姓名、学生类别、学生的成绩：");
       Student[] student = new Student[5];
        for (int i = 0; i < student.length; i++) {
            student[i]=new Postgraduate();
           student[i].setName(in.next());
            student[i].setClassification(in.next());
            if (student[i].classification.equals("本科生")) {
                Postgraduate postgraduate = new Postgraduate();
                student[i] = postgraduate;
                student[i].setName(in.next());
                student[i].setClassification(in.next());
            }
            else {
                Undergraduate undergraduate = new Undergraduate();
                student[i]=undergraduate;
                student[i].setName(in.next());
                student[i].setClassification(in.next());
            }
                for (int j=0;j<student[i].score.length;j++) {
                    student[i].score[j] = in.nextDouble();
                }
                student[i].AverageScore();
            student[i].LetterGrades();
        }
        for (int b=0;b<student.length;b++){
                System.out.println(student[b].name+"\t"+
                        student[b].classification+"\t"+student[b].scoreClass);
        }
    }
}
